<template>
	<div id="cont">
		<van-nav-bar
		  left-text="返回"
		  left-arrow
		  @click-left="onClickLeft"
		/>
	<van-swipe class="my-swipe" :autoplay="3000" indicator-color="white">
	  <van-swipe-item v-for="item of data.imgs">
		  <img :src="item" style="width: 100%;height: 100%;">
		  <span>{{item}}</span>
	  </van-swipe-item>
	</van-swipe>
	<van-cell-group style="margin-bottom: 1rem;margin-top: 1rem;" inset >
	  <van-cell :title="data.product_name"/>
	  <van-cell title="花语"  :label="data.title" />
	  <van-cell title="售价" :label="data.price"/>
	</van-cell-group>
	<van-goods-action>
	  <van-goods-action-icon icon="chat-o" text="客服"  />
	  <van-goods-action-icon icon="cart-o" text="购物车" @click="onshopp" />
	  <van-goods-action-icon icon="shop-o" text="店铺"  />
	  <van-goods-action-button
	    type="danger"
	    text="立即购买"
		@click="onClickButton(data._id)"
	  />
	</van-goods-action>
	</div>
</template>

<script>
	import { Toast } from 'vant';
	import axios from 'axios'
	export default {
		name:'cont',
		props:{
		},
		data(){
			return{
				current: 0,
				data:''
			}
		},
	  methods: {
	    onClickLeft() {
	      this.$router.push('/home')
	    },
		onChange(index) {
			this.current = index;
		},
		// 购物车
		onshopp() {
		    this.$router.push('/shopp')
		},
		onClickButton(id){
			this.$router.push(`/shopp/${id}`)
		}
	  },
	  created(){
		  let id =this.$route.params.id
		 axios({
			 url:`/api/xjr/xjr/${id}`,
		 }).then(res=>{
			 this.data = res.data.data
			 console.log(this.data)
		 })
	  }
	};
</script>

<style>
	#cont{
		background-color:#f2f2f2;
	}
	   .my-swipe .van-swipe-item {
	      color: #fff;
	      font-size: 20px;
	      line-height: 150px;
	      text-align: center;
	    }
</style>
